import 'package:json2dart_safe/json2dart.dart';
import 'dart:convert';

class User {
  String? role;
  String? createTime;
  String? nickname;
  String? updateTime;
  String? id;
  String? avatar;
  String? username;
  String? status;

  User({
    this.role,
    this.createTime,
    this.nickname,
    this.updateTime,
    this.id,
    this.avatar,
    this.username,
    this.status,
  });

  Map<String, dynamic> toJson() => {
        'role': role,
        'createTime': createTime,
        'nickname': nickname,
        'updateTime': updateTime,
        'id': id,
        'avatar': avatar,
        'username': username,
        'status': status,
      };

  User.fromJson(Map json) {
    role = json.asString('role');
    createTime = json.asString('createTime');
    nickname = json.asString('nickname');
    updateTime = json.asString('updateTime');
    id = json.asString('id');
    avatar = json.asString('avatar');
    username = json.asString('username');
    status = json.asString('status');
  }

  @override
  String toString() => jsonEncode(toJson());
}
